/**
 * Implementacion de la clase MapObject
 */ 
#include "mapObject.hpp"
#include "../config/config.hpp"

MapObject::MapObject(Object *o){
	this->object = o;
	this->setId(this->object->getId());
	this->setMapElementType(OBJECT);
	
	std::string source;
	switch(this->getType()){
		case HOTEL:
			source = Config::get("hotel_image_source");
			break;

		case RESTAURANT:
			source = Config::get("restaurant_image_source");
			break;
		
		case COMISARIA:
			source = Config::get("police_image_source");
			break;

		case ESCUELA:
			source = Config::get("school_image_source");
			break;

		case HOSPITAL:
			source = Config::get("hospital_image_source");
			break;

		default:
			source = Config::get("hospital_image_source");
	}

	this->setImageSource(source);
	this->setImageWidth(31);
	this->setImageHeight(31);
	
}

MapObject::MapObject(std::string id)
{
	this->setId(id);
	this->setMapElementType(OBJECT);
}

std::string MapObject::getEdgeId(){
	return this->object->getEdgeId();
}

int MapObject::getHeight(){
	return this->object->getHeight();
}

ObjectType MapObject::getType(){
	return this->object->getType();
}

bool MapObject::hasSamePosition(MapObject *otherMO){
	if((this->getHeight() == otherMO->getHeight())&&(this->getEdgeId() == otherMO->getEdgeId()))
		return true;
	return false;
}
